package filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;

@WebFilter("/a")
public class A2Filter implements Filter{

	@Override
	public void destroy() {
		System.out.println("A2Filter destroy...");
	}   

	// 要重写的方法
	@Override
	public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
			throws IOException, ServletException {
		System.out.println("A2Filter doFilter 前.......");
		// 给请求放行
		chain.doFilter(req, resp);
		
		System.out.println("A2Filter doFilter 后.......");
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		System.out.println("A2Filter init...");
	}

}
